<%--
  Created by IntelliJ IDEA.
  User: LQ
  Date: 2023/8/9
  Time: 17:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>业务综合管理系统</title>
    <link rel="stylesheet" type="text/css" href="style/login/css/reset.css">
    <link rel="stylesheet" type="text/css" href="style/login/css/scanboardLogin.css">
    <link rel="stylesheet" type="text/css" href="style/login/css/animsition.css">
    <script src="script/jquery-1.8.3.min.js"></script>
</head>
<body>
<div class="wp animsition" style="animation-duration: 0.8s; opacity: 1;">
    <div class="boardLogin">
        <a class="logo" style="font-size: 40px; color: goldenrod">业务综合管理系统 </a>
        <form>
            <div class="inpGroup">
                <span class="loginIco1"></span>
                <input type="text" name="login" placeholder="请输入您的用户名">
            </div>
            <div class="prompt">
                <p class="error">
                    用户名错误或不存在</p>
            </div>
            <div class="inpGroup">
                <span class="loginIco2"></span>
                <input type="password" name="pwd" placeholder="请输入您的密码">
            </div>
            <div class="prompt">
                <p class="success">
                    输入正确</p>
            </div>
            <!-- <button class="submit">登录</button> -->
            <a href="javascript:login()" class="animsition-link submit">登录</a>
        </form>
    </div>
</div>
<div id="particles-js">
    <canvas class="particles-js-canvas-el" width="1920" height="278" style="width: 100%;
            height: 100%;"></canvas>
</div>
<script src="script/jquery.cookie.js"></script>
<%--<script type="text/javascript" src="style/login/js/jquery.min.js"></script>--%>
<script src="style/login/js/particles.min.js"></script>
<script src="style/login/js/app.js"></script>
<link href="style/hplus/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<script src="style/hplus/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="script/commonJs.js"></script>
<script type="text/javascript">
    $(document).keypress(function (e) {
        // 回车键事件
        if (e.which == 13) {
            login();
        }
    });

    function login() {
        var login = $('input[name="login"]').val();
        var pwd = $('input[name="pwd"]').val();
        if (login == '') {
            com.alterMessage('请输入您的账号！', 'warning');
            return false;
        } else if (pwd == '') {
            com.alterMessage('请输入密码！', 'warning');
            return false;
        }

        $.ajax({
            url: '../users/userLogin',
            type: 'post',
            dataType: 'json',
            data: {
                userName: login,
                passWord: pwd
            },
            success: function (result) {
                if (result.resultCode == 200) {
                    //登录成功
                    $.cookie("users", result.data);
                    //跳转操作
                    window.location.href = 'Index.jsp';
                } else {
                    com.alterMessage(result.msg, 'warning');
                }
            }
        });
    }
</script>
</body>
</html>
